<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>inputEx - MapField Usage</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../../../lib/yui/reset/reset-min.css">
<link rel="stylesheet" type="text/css" href="../../../lib/yui/fonts/fonts-min.css">
<link rel="stylesheet" type="text/css" href="../../../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../../../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../../../css/inputEx.css' />

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="../../../examples/css/demo.css"/>
<link rel="stylesheet" type="text/css" href="../../../examples/css/dpSyntaxHighlighter.css">


 </head>

<body class="yui-skin-sam">

<p class='demoTitle'>inputEx - MapField Usage</p>


<!-- Example 1 -->
<div class='exampleDiv'>

	<p class="title">Virtual Earth MapField creation</p>
	
	<p>Use the following code to create a inputEx MapField for Virtual Earth.</p>

	<div class='demoContainer' id='container1'></div>

	<div class='codeContainer'>
		<form>
		<textarea name="code" class="JScript" cols="60" rows="5">
		var id = 'container1';
		var api = 'virtualearth';
		var elExample = new YAHOO.inputEx.MapField({parentEl: id, name: 'mapField', width: '800px', api: api});

		var elButton = YAHOO.inputEx.cn('button', null, null, "getValue");
		YAHOO.util.Event.addListener(elButton, 'click', function() {
			alert( YAHOO.lang.JSON.stringify(elExample.getValue()) );
		});
		YAHOO.util.Dom.get(id).appendChild(elButton);
		</textarea>
		</form>
	</div>

</div>

<!-- Example 2 -->
<div class='exampleDiv'>

	<p class="title">Yahoo Maps MapField creation</p>
	
	<p>Use the following code to create a inputEx MapField for Yahoo Maps.</p>

	<div class='demoContainer' id='container2'></div>

	<div class='codeContainer'>
		<form>
		<textarea name="code" class="JScript" cols="60" rows="5">
		var id = 'container2';
		var api = 'yahoo';
		var elExample = new YAHOO.inputEx.MapField({parentEl: id, name: 'mapField', width: '800px', api: api});

		var elButton = YAHOO.inputEx.cn('button', null, null, "getValue");
		YAHOO.util.Event.addListener(elButton, 'click', function() {
			alert( YAHOO.lang.JSON.stringify(elExample.getValue()) );
		});
		YAHOO.util.Dom.get(id).appendChild(elButton);
		</textarea>
		</form>
	</div>

</div>

<!-- Example 3 -->
<div class='exampleDiv'>

	<p class="title">Google Maps MapField creation</p>
	
	<p>Use the following code to create a inputEx MapField for Google Maps.</p>

	<div class='demoContainer' id='container3'></div>

	<div class='codeContainer'>
		<form>
		<textarea name="code" class="JScript" cols="60" rows="5">
		var id = 'container3';
		var api = 'google';
		var elExample = new YAHOO.inputEx.MapField({parentEl: id, name: 'mapField', width: '800px', api: api});

		var elButton = YAHOO.inputEx.cn('button', null, null, "getValue");
		YAHOO.util.Event.addListener(elButton, 'click', function() {
			alert( YAHOO.lang.JSON.stringify(elExample.getValue()) );
		});
		YAHOO.util.Dom.get(id).appendChild(elButton);
		</textarea>
		</form>
	</div>

</div>

<!-- Example 4 -->
<div class='exampleDiv'>

	<p class="title">Default MapField creation</p>
	
	<p>
	Use the following code to create a inputEx MapField for whatever the default API is.
	We should complete this example by making buttons to change the default and store
	that in cookies.
	</p>

	<div class='demoContainer' id='container4'></div>

	<div class='codeContainer'>
		<form>
		<textarea name="code" class="JScript" cols="60" rows="5">
		var id = 'container4';
		var elExample = new YAHOO.inputEx.MapField({parentEl: id, name: 'mapField', width: '800px'});

		var elButton = YAHOO.inputEx.cn('button', null, null, "getValue");
		YAHOO.util.Event.addListener(elButton, 'click', function() {
			alert( YAHOO.lang.JSON.stringify(elExample.getValue()) );
		});
		YAHOO.util.Dom.get(id).appendChild(elButton);
		</textarea>
		</form>
	</div>

</div>

<!-- YUI Library -->
<script type="text/javascript" src="../../../lib/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="../../../lib/yui/container/container-min.js"></script>
<script type="text/javascript" src="../../../lib/yui/json/json-min.js"></script>

<!-- YUI for Yahoo Maps AJAX API -->
<script type="text/javascript" src="../../../lib/yui/dragdrop/dragdrop-min.js"></script>
<script type="text/javascript" src="../../../lib/yui/animation/animation-min.js"></script>

<!-- Yahoo Maps AJAX API -->
<!--
<script type="text/javascript">
YMAPPID = 'Nk0DZDzV34FM2CIAsdRAtUgQJRSsJO7x2l5tuDBduamC_gZWkzyTEqcUJxAWjtqxs9Wnxb0-';
</script>
<script type="text/javascript" src="xhttp://us.js2.yimg.com/us.js.yimg.com/lib/map/js/api/ymapapi_3_8_0_7.js">
</script>
-->

<!-- InputEx -->
<script src="../../../js/inputex.js"  type='text/javascript'></script>
<script src="../../../js/Field.js"  type='text/javascript'></script>
<script src="MapField.js"  type='text/javascript'></script>

<script>

// how to set up Virtual Earth as the default API
if (1) {
	YAHOO.inputEx.MapFieldGlobals['api'] = 'virtualearth';
}

// how to set Google Maps as the default API; note the per-host API keys
if (1) {
	YAHOO.inputEx.MapFieldGlobals['api'] = 'google';
	YAHOO.inputEx.MapFieldGlobals['api_key'] = {
		'localhost' : 'ABQIAAAADeqGsYygYHMVWXMDJEowhBRA0pJg_vyJNqxN8QciTwW1nvTY9xTHCJ6F7R04FjG06dKgcV5wpIxzZQ',
		'code.davidjanes.com' : 'ABQIAAAADeqGsYygYHMVWXMDJEowhBRA0pJg_vyJNqxN8QciTwW1nvTY9xTHCJ6F7R04FjG06dKgcV5wpIxzZQ',
		'javascript.neyric.com' : ''
	}
}

// how to set up Yahoo Maps as the default API
if (1) {
	YAHOO.inputEx.MapFieldGlobals['api'] = 'yahoo';
	YAHOO.inputEx.MapFieldGlobals['Nk0DZDzV34FM2CIAsdRAtUgQJRSsJO7x2l5tuDBduamC_gZWkzyTEqcUJxAWjtqxs9Wnxb0-'] = 'yahoo';
}

YAHOO.util.Event.addListener(window, 'load', function() {
	if (1) {
		var id = 'container1';
		var api = 'virtualearth';
		var elExample1 = new YAHOO.inputEx.MapField({parentEl: id, name: 'mapField', width: '800px', api: api});

		var elButton1 = YAHOO.inputEx.cn('button', null, null, "getValue");
		YAHOO.util.Event.addListener(elButton1, 'click', function() {
			alert(YAHOO.lang.JSON.stringify(elExample1.getValue()) );
		});
		YAHOO.util.Dom.get(id).appendChild(elButton1);
	}
	if (1) {
		var id = 'container2';
		var api = 'yahoo';
		var elExample2 = new YAHOO.inputEx.MapField({parentEl: id, name: 'mapField', width: '800px', api: api});

		var elButton2 = YAHOO.inputEx.cn('button', null, null, "getValue");
		YAHOO.util.Event.addListener(elButton2, 'click', function() {
			alert( YAHOO.lang.JSON.stringify(elExample2.getValue()) );
		});
		YAHOO.util.Dom.get(id).appendChild(elButton2);
	}
	if (1) {
		var id = 'container3';
		var api = 'google';
		var elExample3 = new YAHOO.inputEx.MapField({parentEl: id, name: 'mapField', width: '800px', api: api});

		var elButton3 = YAHOO.inputEx.cn('button', null, null, "getValue");
		YAHOO.util.Event.addListener(elButton3, 'click', function() {
			alert( YAHOO.lang.JSON.stringify(elExample3.getValue()) );
		});
		YAHOO.util.Dom.get(id).appendChild(elButton3);
	}
	if (1) {
		var id = 'container4';
		var elExample4 = new YAHOO.inputEx.MapField({parentEl: id, name: 'mapField', width: '800px'});

		var elButton4 = YAHOO.inputEx.cn('button', null, null, "getValue");
		YAHOO.util.Event.addListener(elButton4, 'click', function() {
			alert( YAHOO.lang.JSON.stringify(elExample4.getValue()) );
		});
		YAHOO.util.Dom.get(id).appendChild(elButton4);
	}
});
</script>

<script src="../../../examples/js/dpSyntaxHighlighter.js"></script>
<script language="javascript"> 
dp.SyntaxHighlighter.HighlightAll('code');
</script>

 </body>
</html>
